AskInt 0 1 0 'Choose BACKGROUND source method:\n0 = Static 1 = Animated\nSee documentation for more information.'
If RC = 5 Then Do
Okay 'Exiting...'
Exit
End
Method = Result
/* Get flame colour */
AskInt 1 6 1 'Choose flame colour:\n1 = Normal 2 = Yellow 3 = Red 4 = Blue 5 = Green 6 = Purple'
If RC = 5 Then Do
Okay 'Exiting...'
Exit
End
FlameColour = Result
/* Ask flame size (Diffuse value) */
AskInt 1 31 11 'Choose flame size:\nFrom 1 to 31.'
If RC = 5 Then Do
Okay 'Exiting...'
Exit
End
FlameSize = Result
/* Convert FlameSize into an odd number if needed */
If FlameSize/2 = FlameSize%2 Then FlameSize = FlameSize - 1
/* Ask smooth value (# of smoothing passes) */
AskInt 1 3 1 'Choose flame smoothing:\nFrom 1 to 3.\nThis is the number of smooth passes.'
If RC = 5 Then Do
Okay 'Exiting...'
Exit
End
SmoothValue = Result
/* Ask intensity (# of times the flame brush is stamped) */
AskInt 1 4 1 'Choose flame intensity.'
If RC = 5 Then Do
Okay 'Exiting...'
Exit
End
FlameIntensity = Result
/* Get background source image(s) pathname: */
Do Forever
Askstring 'Enter the pathname of your BACKGROUND source image(s).\nEnter pathname only, and WITHOUT final "/"\nExample: "DH0:Torch/" = wrong "DH0:Torch" = right'
If RC = 5 Then Do
Okay 'Exiting...'
Exit
End
If Result ~= "" Then Do
BackgroundSource = Result
Finder = Exists(BackgroundSource || '/')
If Finder = 1 Then Do
Leave
End
End
Okay 'Drawer not found! Check your spelling.'
End
/* Check for first image of Backgrounds for Method 0 */
If Method = 0 Then Do
Finder = Exists(BackgroundSource || '/pic.0001')
If Finder = 0 Then Do
Okay 'FATAL ERROR! There must be at least a "pic.0001" image\nin your background source drawer when using method 1.\nExiting...'
Exit
End
End
/* Get flame source images pathname: */
Do Forever
Askstring 'Enter the pathname of your FLAME source images.\nEnter pathname only, and WITHOUT final "/"\nExample: "DH0:Torchflame/" = wrong "DH0:Torchflame" = right'
If RC = 5 Then Do
Okay 'Exiting...'
Exit
End
If Result ~= "" Then Do
FlameSource = Result
If FlameSource = BackgroundSource Then Do
Okay 'FATAL ERROR! The FLAME source images can NOT be in\nthe same drawer as the BACKGROUND source images.\nPlease make sure you are REALLY ready to launch this script.\nRead the documentation for more info. Exiting...'
Exit
End
Finder = Exists(FlameSource || '/')
If Finder = 1 Then Do
Leave
End
End
Okay 'Drawer not found! Check your spelling.'
End
/* Get starting FLAME frame number */
AskInt 1 9998 1 'Enter starting FLAME frame number as a normal number\nExamples:\n1 = Right pic.0001 = Wrong 0001 = Wrong\nSee documentation for more information.'
If RC = 5 Then Do
Okay 'Exiting...'
Exit
End
StartFrame = Result
/* Get Ending FLAME frame number */
Do Forever
AskInt 1 9999 20 'Enter Ending FLAME frame number as a normal number\nExamples:\n1 = Right pic.0001 = Wrong 0001 = Wrong\nSee documentation for more information.'
If RC = 5 Then Do
Okay 'Exiting...'
Exit
End
EndFrame = Result
If EndFrame >= StartFrame Then Leave
Okay 'Ending FLAME frame number should be equal to or higher than\nStarting FLAME frame number. Try again.'
End
/* Get Destination drawer for Method 0*/
If Method = 0 Then Do
AskString 'Enter pathname for "flamed" destination images.\nWITHOUT final "/"\nExample: "DH0:Torchflame/" = wrong "DH0:Torchflame" = right'
If RC = 5 Then Do
Okay 'Exiting...'
Exit
End
Do Forever
If Result ~= "" Then Do
FlameDest = Result
Finder = Exists(FlameDest || '/')
If Finder = 1 Then Do
Leave
End
If Finder = 0 Then Do
AskBool 'Drawer not found. Create one?\n[Cancel = No, lemme try agian]'
If Result = 1 Then Do
AskBool 'You typed:\n' || FlameDest || '\nIs this the drawer you want?\n[Cancel = No, lemme try agian]'
If Result = 1 Then Do
Address Command
'Makedir ' || FlameDest
Address 'OpalPaint_Rexx'
Leave
End
End
End
End
AskString 'Drawer not found! Try Again.'
If RC = 5 Then Do
Okay 'Exiting...'
Exit
End
End
If FlameDest = BackgroundSource Then Do
Okay 'FATAL ERROR! The FLAMED destination images can NOT be in\nthe same drawer as the BACKGROUND source images.\nPlease make sure you are REALLY ready to launch this script.\nRead the documentation for more info. Exiting...'
Exit
End
End
/* Ask if user wants to overwrite original files for Method 1*/
If Method = 1 Then Do
AskBool 'Overwrite original Background source images with the new\n"flamed" images? [Cancel = No]'
Overwrite = Result
If Overwrite = 0 Then Do
AskString 'Enter pathname for "flamed" destination images.\nWITHOUT final "/"\nExample: "DH0:Torchflame/" = wrong "DH0:Torchflame" = right'
If RC = 5 Then Do
Okay 'Exiting...'
Exit
End
End
If Overwrite = 0 Then Do Forever
If Result ~= "" Then Do
FlameDest = Result
Finder = Exists(FlameDest || '/')
If Finder = 1 Then Do
Leave
End
If Finder = 0 Then Do
AskBool 'Drawer not found. Create one?\n[Cancel = No, lemme try agian]'
If Result = 1 Then Do
AskBool 'You typed:\n' || FlameDest || '\nIs this the drawer you want?\n[Cancel = No, lemme try agian]'
If Result = 1 Then Do
Address Command
'Makedir ' || FlameDest
Address 'OpalPaint_Rexx'
Leave
End
End
End
End
AskString 'Drawer not found! Try Again.'
If RC = 5 Then Do
Okay 'Exiting...'
Exit
End
End
End
/* Here we go!! I'll take it from here. */
Address 'OpalPaint_Rexx'
Okay 'Here we go.'
Busy
GetPrefs
Panic
Do A = StartFrame to EndFrame
/* Get IFF Variables */
Iff = Root || Zero || Zero || Zero || A
If A < 10000 & A > 999 Then Iff = Root || A
If A < 1000 & A > 99 Then Iff = Root || Zero || A
If A < 100 & A > 9 Then Iff = Root || Zero || Zero || A
/* Search for next FLAME frame and load*/
DisplayStatus 'Find ' || A
Finder = Exists(FlameSource || '/' || Iff)
If Finder = 1 Then Do
Load Flamesource || '/' || Iff
PageSize
Parse Var Result X2 Y2
/* Set pots */
SetPot 1 0 0 0
SetPot 2 255 255 255
If FlameColour = 1 Then Do
DisplayStatus 'Normal CLR'
SetPot 3 255 240 0
SetPot 4 240 127 0
SetPot 5 240 0 0
SetPot 6 120 0 0
End
If FlameColour = 2 Then Do
DisplayStatus 'Yellow CLR'
SetPot 3 255 240 0
SetPot 4 210 180 0
SetPot 5 165 119 0
SetPot 6 120 58 0
End
If FlameColour = 3 Then Do
DisplayStatus 'Red CLR'
SetPot 3 255 123 0
SetPot 4 255 0 0
SetPot 5 188 0 0
SetPot 6 120 0 0
End
If FlameColour = 4 Then Do
DisplayStatus 'Blue CLR'
SetPot 3 0 214 255
SetPot 4 0 86 255
SetPot 5 0 43 188
SetPot 6 0 0 120
End
If FlameColour = 5 Then Do
DisplayStatus 'Green CLR'
SetPot 3 90 255 90
SetPot 4 0 255 0
SetPot 5 0 188 0
SetPot 6 0 120 0
End
If FlameColour = 6 Then Do
DisplayStatus 'Purple CLR'
SetPot 3 255 0 235
SetPot 4 255 0 209
SetPot 5 172 0 165
SetPot 6 88 0 120
End
SetPot 7 1 1 1
DisplayStatus 'Initialze'
Trans 0
Texture 0
FillMode SOLID
SetDrawMode 1
SmoothPaper
ActiveNozzle 1
MaskSten 0
ColSten 1
/* Check for special brightness code */
If Method = 0 Then Do
DisplayStatus 'Code Check'
MethodCode = 1
ReadPixel 0 0
Parse Var Result R G B
If R > 0 Then MethodCode = 1
ReadPixel 1 0
Parse Var Result R G B
If R > 0 Then MethodCode = 2
ReadPixel 2 0
Parse Var Result R G B
If R > 0 Then MethodCode = 3
ReadPixel 3 0
Parse Var Result R G B
If R > 0 Then MethodCode = 4
ReadPixel 4 0
Parse Var Result R G B
If R > 0 Then MethodCode = 5
End
/* Cleanup corner */
ActivePot 1
StenEnable 0
Line 0 0 5 0
/* Turn on Stencil to fix white to 255 255 255 */
DisplayStatus 'Fix White'
SetColSten 1 0 0 0 0 0 0 0
EnableColEntry 1 1
StenEnable 0
ActivePot 2
Point 0 0
FreeHand 0 0
LastPoint 0 0
StenEnable 1
RectCut 0 0 X2 Y2
StenEnable 0
Handle 0 0
ColourSource 'PAINTPOT'
PutBrush 0 0
ColourSource 'MULTICOLOUR'
BrushSize
parse var Result BX2 BY2
/* Pick up White flame image */
ActiveNozzle 1
NozzleSize 1 1
ActivePot 1
Point 0 0
FreeHand 0 0
LastPoint 0 0
StenEnable 1
DisplayStatus 'Get Brush'
ActiveBrush 2
RectCut 0 0 BX2 BY2
Handle 0 0
/*Get upper-left Brush Sizer */
BrushSize
parse var Result BX1 BY1
BX1 = BX2 - BX1
BY1 = BY2 - BY1
BX1 = BX1 - (FlameSize + 7)
BY1 = BY1 - (FlameSize + 7)
If BX1 < 0 Then BX1 = 0
If BY1 < 0 Then BY1 = 0
BX2 = BX2 + (FlameSize + 7)
BY2 = BY2 + (FlameSize + 7)
If BX2 > X2 Then BX2 = X2
If BY2 > Y2 Then BY2 = Y2
StenEnable 0
/* Clean up corner again */
StenEnable 0
ActivePot 1
ActiveNozzle 1
NozzleSize 0 0
Point 0 0
FreeHand 0 0
LastPoint 0 0
Point BX1 BY1
FreeHand BX1 BY1
LastPoint BX1 BY1
/* Diffuse White flame image */
DisplayStatus 'Diffuse 1'
SetSpare 1 Diffuse
SetDrawMode 19 FlameSize
SetDrawMode 19 FlameSize
SolidRect BX1 BY1 BX2 BY2
/* Add 'Handle Dot' */
DisplayStatus 'Handle Dot'
SetDrawMode 1
ActivePot 7
ActiveNozzle 1
NozzleSize 1 1
Point BX1 BY1
FreeHand BX1 BY1
LastPoint BX1 BY1
/* Pick up White flame image */
StenEnable 1
DisplayStatus 'Get Brush'
ActiveBrush 1
RectCut BX1 BY1 X2 Y2
Handle 0 0
StenEnable 0
ActiveNozzle 1
NozzleSize 1 1
Point BX1 BY1
FreeHand BX1 BY1
LastPoint BX1 BY1
/* Outline Brush with flame colours */
ActiveBrush 1
ActivePot 3
NotBusy
Key 'o'
ActivePot 4
Key 'o'
Key 'o'
ActivePot 5
Key 'o'
Key 'o'
ActivePot 6
Key 'o'
Busy
/* Stamp coloured brush down */
DisplayStatus 'stamping'
Handle 6 6
StenEnable 0
ColourSource 'MULTICOLOUR'
PutBrush BX1 BY1
/* Cleanup corner */
ActivePot 1
StenEnable 0
NewBX1 = BX1 - 6
If NewBX1 < 0 Then NewBX1 = 0
NewBY1 = BY1 - 6
If NewBY1 < 0 Then NewBY1 = 0
SolidRect NewBX1 NewBY1 (BX1 + 6) (BY1 + 6)
/* Diffuse Coloured flame image */
DisplayStatus 'Diffuse 2'
SetDrawMode 19 FlameSize
SetDrawMode 19 FlameSize
SolidRect BX1 BY1 BX2 BY2
/* Smooth image */
ActivePot 1
ActiveNozzle 1
NozzleSize 1 1
SetSpare 1 Blur
SetDrawMode 19 100
SetDrawMode 19 100
Do Smoothy = 1 to SmoothValue
SolidRect BX1 BY1 BX2 BY2
End
SetDrawMode 16 100
SetDrawMode 16 100
Do SmoothyB = 1 to 4
Line NewBX1 0 BX2 0
End
/* Repair Handle Dot */
SetDrawMode 1
ActivePot 7
Point BX1 BY1
FreeHand BX1 BY1
LastPoint BX1 BY1
/* Pick up finished flame brush! */
ActiveBrush 1
RectCut BX1 BY1 BX2 BY2
Handle 0 0
/* Method 0 */
If Method = 0 Then Do
If MethodCode = 1 Then Do
Load BackgroundSource || '/pic.0001'
End
If MethodCode = 2 Then Do
Finder = Exists(BackgroundSource || '/pic.0002')
If Finder = 0 Then Load BackgroundSource || '/pic.0001'
If Finder = 1 Then Load BackgroundSource || '/pic.0002'
End
If MethodCode = 3 Then Do
Finder = Exists(BackgroundSource || '/pic.0003')
If Finder = 0 Then Load BackgroundSource || '/pic.0001'
If Finder = 1 Then Load BackgroundSource || '/pic.0003'
End
If MethodCode = 4 Then Do
Finder = Exists(BackgroundSource || '/pic.0004')
If Finder = 0 Then Load BackgroundSource || '/pic.0001'
If Finder = 1 Then Load BackgroundSource || '/pic.0004'
End
If MethodCode = 5 Then Do
Finder = Exists(BackgroundSource || '/pic.0005')
If Finder = 0 Then Load BackgroundSource || '/pic.0001'
If Finder = 1 Then Load BackgroundSource || '/pic.0005'
End
End
/* Method 1 */
If Method = 1 Then Do
Finder = Exists(BackgroundSource || '/' || Iff)
If Finder = 0 Then Do
Okay 'FATAL ERROR! Background source image is missing!\nSorry, gotta exit.'
Exit
End
Load BackGroundSource || '\' || Iff
End
/* Add Fire to image */
SetDrawMode 2 100
ActiveBrush 1
Handle 0 0
Do Loopsy = 1 to FlameIntensity
Putbrush BX1 BY1
End
/* Save composited image for Method 0 */
If Method = 0 Then Do
Save FlameDest || '/' || Iff
End
/* Save composited image for Method 1 */
If Method = 1 Then Do
If Overwrite = 0 Then Do
Save FlameDest || '/' || Iff
End
If Overwrite = 1 Then Do
Save BackgroundSource || '/' || Iff
End
End
End
End
/*All Done! */
Okay 'Operation Complete! Go animate it and impress your friends!'